<template>
  <div class="top-bar">
    <div class="bar-title">
      <slot name="title">{{ titleShow ? title : '' }}</slot>
    </div>
    <el-button
      class="closed"
      type="text"
      icon="el-icon-close"
      title="关闭"
      @click="$emit('clear-player')"
    ></el-button>
  </div>
</template>

<script>
export default {
  name: 'TopBar',
  props: {
    title: {
      type: String,
      default: '标题栏'
    },
    titleShow: {
      type: Boolean,
      default: true
    }
  }
}
</script>

<style scoped lang="scss">
.top-bar {
  width: 100%;
  height: 30px;
  line-height: 30px;
  transition: all .2s ease-in-out;
  background: #606266;
  display: flex;
  align-items: center;
  justify-items: center;

  .bar-title {
    width: 100%;
    padding: 0 30px 0 15px;
    text-align: left;
    color: rgba(255, 255, 255, .8);
  }

  .closed {
    position: absolute;
    right: 5px;
    top: 5px;
    padding: 0;
    font-size: 16px;
    color: rgba(255, 255, 255, .8);

    &:hover {
      color: red;
    }
  }
}
</style>